package com.baichang.taoshunda.dao.impl;

import com.baichang.framework.dao.impl.BaseDaoImpl;
import com.baichang.framework.model.Page;
import com.baichang.taoshunda.dao.HtmlDao;
import com.baichang.taoshunda.entity.Html;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * Created by Administrator on 2017/9/20 0020.
 */
@Repository
public class HtmlDaoImpl extends BaseDaoImpl<Html> implements HtmlDao {
    /**
     * 查询用户协议
     *
     * @param nowPage
     * @param pageSize
     * @return
     */
    @Override
    public Page queryHtmlInfo(int nowPage, int pageSize) {
        String sql = "SELECT * FROM {table}";
        return pageForBeanList(sql, nowPage, pageSize);
    }

    /**
     * 修改
     *
     * @param map
     * @param id
     * @return
     */
    @Override
    public int update(Map map, Integer id) {
        String sql = "id=?";
        return update(sql, map, id);
    }

    /**
     * 须知
     *
     * @param is 1假一赔三 2消费者
     * @return
     */
    @Override
    public Map<String, Object> getInfo(Integer is) {
        String sql = "SELECT * FROM {table}";
        if (is == 2) {
            sql += "  WHERE id=23";
        } else {
            sql += "  WHERE id=22";
        }
        return queryForMap(sql);
    }
}
